package com.university.report.user.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.university.report.model.entity.ReportInfo;
import com.university.report.model.vo.ReportInfoVO;
import com.university.report.user.service.impl.ReportInfoServiceImpl;
import lombok.Getter;
import org.springframework.stereotype.Repository;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author Jinondo
 * @since 2021-06-09
 */
@Repository
public interface ReportInfoService extends IService<ReportInfo> {

    @Getter
    enum ReportStatus{
        // 描述健康上报提交后的状态
        SUCCESS(1,"健康上报提交成功"),
        FAIL(0,"健康上报提交失败"),
        REPORTED(2,"已经上报，请勿重复提交");

        private Integer code;
        private String message;

        ReportStatus(Integer code) {
            this.code = code;
        }

        ReportStatus(Integer code, String message) {
            this.code = code;
            this.message = message;
        }
    }

    /**
     * 总体筛选
     *
     * @param department 学院
     * @param dateString 时间
     * @param healthCon 筛选体温异常或身体状况异常
     * @param impRegion 查找最近15天到达或途径疫情防控重点区域记录
     * @return
     */
    Map<String, Object> getInfoByCond(Integer currentPage,
                                      String department,
                                      String dateString,
                                      Integer healthCon,
                                      Integer impRegion);

    /**
     * 导出数据 Execl
     * @param response
     */
    void exportData(HttpServletResponse response,
                    String department, String dateString);


    void exportDataByCond(HttpServletResponse response,
                          Integer currentPage,
                          String department,
                          String dateString,
                          Integer healthCon,
                          Integer impRegion);

    /**
     * 根据学院和指定日期获取上报信息
     * @param department
     * @param timeString
     * @return
     */
    List<ReportInfoVO> getInfoByDepNDate(String department,String timeString);

    @Deprecated
    List<ReportInfo> getInfoByTime(String timeString);

    Map<String, Object> getInfoToday(Integer currentPage);

    Map<String, Object> getInfoByDate(Integer currentPage, String timeString);

    List<ReportInfoVO> getReportInfoByUserIdSort(Integer userId);

    ReportInfoVO getOneInfoByUserId(Integer userId);

    ReportInfoServiceImpl.ReportStatus report(ReportInfo reportInfo);

    void reportMQ(ReportInfo reportInfo);

    /**
     * 特定日期
     * 根据身体状况异常或体温异常查询
     * @return
     */
    public List<ReportInfoVO> getUnusualHealthDate(String timeString);

    /**
     * 今天
     * 根据身体状况异常或体温异常查询
     * @return
     */
    public List<ReportInfoVO> getUnusualHealthToday();

    /**
     * 获取进15天出入过疫情高风险地区记录
     * @param timeString
     * @return
     */
    List<ReportInfoVO> getImpRegion(String timeString);


}
